package com.horse.cloud.framework.redis;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @create : Created by intelliJ IDEA 17.2
 * @author : bing.Pan
 * @e-mail : 15923508369@163.com
 * @gmdate : 11 02 2017 14:37
 * @sidesc :
 */

@Component
@ConfigurationProperties(prefix = "spring.redis")
@Data
public class RedisProperties {

    /** 运行模式 */
    private String redisMode;


    /** 通用配置信息*/
    private int     timeout;


    /** 单机配置文件*/
    private RedisProperties.StandAlone standAlone;

    /** 通用连接池配置 */
    private RedisProperties.Pool pool;

    /** 集群配置*/
    private RedisProperties.Cluster cluster;




    @Data
    protected static class StandAlone{
        private int     database;
        private String  host;
        private int     port;
        private String  password;

    }


    @Data
    protected static class  Pool{
        private int     maxTotal;
        private int     maxWait;
        private int     maxIdle;
        private int     minIdle;
        private Boolean testOnBorrow;
        private Boolean testOnReturn;
        private Boolean testWhileIdle;
        private int     timeBetweenEvictionRunsMillis;
        private int     numTestsPerEvictionRun;
        private int     minEvictableIdleTimeMillis;
    }


    @Data
    protected static class Cluster{
        private String nodes;
        private int maxRedirects;

    }




}




